package src.ten;

import java.util.*;

public class CollectionDemo01 {

    public static void main(String[] args) {
        List<String> list = new ArrayList<String>();
        list.add("apple");
        list.add("pear");
        list.add("banana");
        list.add("apple");

        Set<String> set = new HashSet<String>();
        set.addAll(list);
        Iterator<String> iterator = set.iterator();
        System.out.println("集合中的元素：");
        while (iterator.hasNext()){
            System.out.println(iterator.next()+"\t");
        }
    }
}
